package com.kingdee.eas.mx.imp.impl.app;

import org.apache.log4j.Logger;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.mx.basedata.enums.StateEnum;
import com.kingdee.eas.mx.imp.impl.ImPLossFactory;
import com.kingdee.eas.mx.imp.impl.ImPLossInfo;

public class ImPLossControllerBean extends AbstractImPLossControllerBean
{
    private static Logger logger =
        Logger.getLogger("com.kingdee.eas.mx.imp.impl.app.ImPLossControllerBean");


	protected IObjectPK _save(Context ctx, IObjectValue model) throws BOSException,
			EASBizException {
		ImPLossInfo iplInfo = (ImPLossInfo)model;
		if(iplInfo.getState().equals(StateEnum.addNew)||iplInfo.getState().equals(StateEnum.save)){
			iplInfo.setStorageF(iplInfo.getStorageFee());
			iplInfo.setDomShiResAmount(iplInfo.getNeiFreight());
			iplInfo.setNeiResAmount(iplInfo.getNeiFreit());
			iplInfo.setInsFeesResAmount(iplInfo.getCustomChange());
			iplInfo.setSeaFreResAmount(iplInfo.getFreight());
			iplInfo.setInsurResAamount(iplInfo.getInsurance());
			iplInfo.setMiscellane(iplInfo.getMiscellaneous());
			iplInfo.setImportLicen(iplInfo.getImportPermitFee());
			iplInfo.setCommissionResAmount(iplInfo.getCommission());
			iplInfo.setDeclaration(iplInfo.getClearanceRee());
			iplInfo.setState(StateEnum.save);
		}
		
		
		return super._save(ctx, model);
	}
    
    
    
}